package cn.iocoder.yudao.module.liveprice.iotdb;

import lombok.extern.slf4j.Slf4j;
import org.apache.iotdb.session.pool.SessionPool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
@EnableConfigurationProperties(IotdbProperties.class)
public class IotDbConfig {

    @Autowired
    private IotdbProperties properties;

    @Bean
    public SessionPool sessionPool() {
        return new SessionPool.Builder()
//                .host("118.89.73.223")
//                .port(6667)
//                .user("root")
//                .password("root")
//                .maxSize(1000)
//                .build();
                .host(properties.getHost())
                .port(properties.getPort())
                .user(properties.getUsername())
                .password(properties.getPassword())
                .maxSize(properties.getMaxSize())
                .build();
    }

}